//流程模块【
//dljgflow.代理机构文件管理】下录入页面自定义js页面,初始函数
function initbodys(){
	loadProjectList();
}

function loadProjectList(){

	js.ajax(js.getajaxurl('getNowYearMergeProject','index','cg')
			,{},function(s){
		var content = "<option value=''>-请选择-</option>";
		var obj=$("select[name='projectnum']");
		$.each(s, function(i, field){
			content += "<option value='"+field.id+"' data-id='"+field.projectid+"'>"+field.name+"</option>";
		});
		if (obj.length>0) {
			obj.html(content);
		}
	},'get,json',false,'');
}

function oninputblur(na, zb, obj){
	var projectid = obj.value;
	if (na == 'projectnum') {
		js.ajax(js.getajaxurl('getNowYearMergeProjectInfo','index','cg'),
			{
				"id":projectid
			}, function(s){
				var data = s;
				$("input[name='dljgname']").val('');
				if(data.proxygov) {
					$("input[name='dljgname']").val(data.proxygov);
				}

				$("input[name='receivetime']").val('');
				if(data.addtime) {
					$("input[name='receivetime']").val(data.addtime);
				}

				$("input[name='projectname']").val('');
				if(data.name) {
					$("input[name='projectname']").val(data.name);
				}

				$("input[name='proxycompany']").val('');
				if(data.companyname) {
					$("input[name='proxycompany']").val(data.companyname);
				}

				$("input[name='zbzxlink']").val('');
				if(data.projectAdminerName) {
					$("input[name='zbzxlink']").val(data.projectAdminerName);
				}

				$("input[name='bugtype']").val('');
				if(data.buymode) {
					$("input[name='bugtype']").val(data.buymode);
				}

				$("input[name='zbzxlinktel']").val('');
				if(data.mobile) {
					$("input[name='zbzxlinktel']").val(data.mobile);
				}

				$("input[name='budget']").val('');
				if(data.budget) {
					$("input[name='budget']").val(data.budget);
				}

				$("input[name='beian_num']").val('');
				if(data.symbol) {
					$("input[name='beian_num']").val(data.symbol);
				}
			},'get,json',false,'');
	}
}

function changesubmit(d) {
	var proxycompanylink = regExp.filter('采购单位联系人', d.proxycompanylink, 'name');
	if(proxycompanylink.bool == false) return proxycompanylink.msg;
	var proxycompanylinktel = regExp.filter('采购单位联系人电话', d.proxycompanylinktel, 'telOrMobile');
	if(proxycompanylinktel.bool == false) return proxycompanylinktel.msg;
	var zbzxlink = regExp.filter('装备中心项目负责人', d.zbzxlink, 'name');
	if(zbzxlink.bool == false) return zbzxlink.msg;
	var zbzxlinktel = regExp.filter('装备中心项目负责人电话', d.zbzxlinktel, 'telOrMobile');
	if(zbzxlinktel.bool == false) return zbzxlinktel.msg;
	var dljglink = regExp.filter('代理机构项目负责人', d.dljglink, 'name');
	if(dljglink.bool == false) return dljglink.msg;
	var dljglinktel = regExp.filter('代理机构项目负责人电话', d.dljglinktel, 'telOrMobile');
	if(dljglinktel.bool == false) return dljglinktel.msg;
}